<template>
  <el-container class="home-container">
    <!-- 头部区域 -->
    <el-header>
      <a href="#/index">
      <img src="./../../assets/image/indexlogo.png" alt /></a>
<!--       
      <el-dropdown>
   <span class="el-dropdown-link">
    下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
  </span> -->
  <!-- <el-dropdown-menu slot="dropdown">
    <el-dropdown-item>查看消息</el-dropdown-item>
    <el-dropdown-item>查看日志</el-dropdown-item>
    <el-dropdown-item>系统资源</el-dropdown-item>
    <el-dropdown-item>在线用户</el-dropdown-item>
    <el-dropdown-item>设置首页</el-dropdown-item>
    <el-dropdown-item>全局广播</el-dropdown-item>
    <el-dropdown-item>设置头像</el-dropdown-item>
    <el-dropdown-item>个人中心</el-dropdown-item>
    <el-dropdown-item>全屏显示</el-dropdown-item>
    <el-dropdown-item>修改密码</el-dropdown-item>
  </el-dropdown-menu>
</el-dropdown> --> 
      <el-button  class="logoutbutton" type="danger"  @click="logout">退出</el-button>
    </el-header>
    <!-- 主题区域 -->
    <el-container>
      <!-- 侧边栏 -->
      <el-aside width="200px">
        <el-menu
          background-color="#efeeee"
          text-color="black"
          active-text-color="#409bff
          "
          :unique-opened="true"
          :router="true"
        >
          <!-- 一级菜单 -->

          <el-submenu 
            :index="item.id + ''"
            v-for="item in menulist"
            :key="item.id"
          >
            <template slot="title" >
              <i :class="icoslist[item.id]"></i>
              <span >{{ item.permissionName }}</span>
            </template>
            <el-menu-item 
              :index="'/' + subItem.perPath + ''"
             
              v-for="subItem in item.childrenList"
             
              :key="subItem.id"
            >
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>{{ subItem.permissionName}}</span>
              </template>
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <!-- 右侧主体区域 -->
        <el-main>
          <!-- 路由占位符 -->
          <router-view></router-view>
        </el-main>
        <!-- 底部 -->
        <el-footer>
<el-card class="footcard" >
<el-row>
<el-col :span="3" >
  <p>Copyright ©2017-2020猛犸科技</p>
</el-col>

</el-row>

</el-card>


        </el-footer>
      </el-container>
    </el-container>
  </el-container>
</template>
<script>
export default {
  data() {
    return {
      //左侧菜单数据
      menulist: [

      ],
      icoslist: {
        1: "el-icon-user",
        2: "el-icon-s-home",
        3: "el-icon-s-operation",
        4: "el-icon-s-help",
        5: "el-icon-news",
        6: "el-icon-info",
        7: "el-icon-setting",
      },
    };
  },
  created() {
    this.getMenuList();

  },
 
  methods: {
    logout() {
      window.sessionStorage.clear();
      this.$router.push("/login");
    },


    async getMenuList() {
      const { data: res } = await this.$http.get("/user-permission/menuList");
      if (res.code !== 200) return this.$message.error(res.msg);
    
      this.menulist = res.data;
    },
  },
};
</script>
<style lang="less" scoped>
.home-container {
  height: 100%;
}

.logoutbutton{
border-radius: 15px;



}
.footcard{
  margin-top: 10px;
font-size: 5px;
height: 40px;
}

.footcard p{
margin-top: 0px;

}
.el-header {
  border-radius: 15px;
  background-color:#efeeee;
  display: flex;
  justify-content: space-between;
  padding-left: 0;
  align-items: center;
  color: black;
  
  font-size: 20px;
  > div {
    display: flex;
    span {
      margin-left: 0;
    }
  }
}
.el-dropdown-item{
  background-color: #efeeee;
}


.el-main{
  margin: 5px;
  border-radius: 15px;
  background-color: #efeeee;
}
.el-footer{
   margin: 5px;
  border-radius: 15px;
   background-color: #efeeee;
}
.el-aside{
   margin: 5px;
  border-radius: 15px;
   background-color: #efeeee;
}
.el-aside .el-menu {
  background-color: #efeeee;
  .el-menu {
     background-color: #efeeee;
    border-right: none;
  }
}

</style>
